package org.testmyapp.entities;

public class BillPositionPk {
	
	public BillPk bill;
	public Integer billPositionNr;

	public BillPositionPk() {

	}

	public BillPositionPk(BillPk bill, int billPositionNr) {
		this.bill = bill;
		this.billPositionNr = billPositionNr;
	}

	@Override
	public boolean equals(Object other) {
		if (other == null) {
			return false;
		}
		if (!other.getClass().equals(this.getClass())) {
			return false;
		}
		BillPositionPk otherObject = (BillPositionPk) other;
		if (otherObject == this) {
			return true;
		}
		if (bill != null && otherObject.bill != null
				&& bill.equals(otherObject.bill)) {
			if (billPositionNr != null && otherObject.billPositionNr != null
					&& billPositionNr.equals(otherObject.billPositionNr)) {
				return true;
			}
		}
		return false;
	}
	
	@Override
	public int hashCode() {
		if(bill == null || billPositionNr == null) {
			return 0;
		}
		else {
			return bill.hashCode() ^ billPositionNr.hashCode();
		}
	}

}
